<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>Title</title>
    <style>
      /*.container {*/
      /*  height: 100vh;*/
      /*  overflow: auto;*/
      /*}*/
      .box-red {
        width: 100%;
        height: 50vh;
      }

      .box-blue {
        width: 100%;
        height: 30vh;
      }

      .box-yellow {
        width: 100%;
        height: 60vh;
      }

      .box-pink {
        width: 100%;
        height: 60vh;
      }
    </style>
  </head>
  <body style="height: 100vh; overflow-y: auto">
    <div class="container">
      <h1>父页面</h1>
      <button onclick="onSendMsg()">发送消息1001</button>
      <button onclick="onSendMsg()">发送消息1002</button>
    </div>

    <iframe src="./index02.html"></iframe>
    <script src="./lib/index.umd.js"></script>
    <script></script>

    <script>
      const { bus, get } = window.sfutils

      let obj = {
				name: 'a',
				b: {
					name: 'b',
					list: [
						{name: '1234'}
          ]
				}
      }

			// console.log(get(obj, 'b.list.[0].name'));


			const onSendMsg = () => {
				console.log('父发送了：', 'hello【1001】', { id: 12342 })
        bus.emit('1001', 'hello【1001】', { id: 12342 })
      }

      bus.on('1001', (...args) => {
        console.log('父监听到【1001】：', ...args)
      })

			bus.on('1001', (...args) => {
				console.log('父监听到【1001-copy】：', ...args)
			})


			bus.on('xxx', (...args) => {
				console.log('父监听到【xxx】：', ...args)
			})
    </script>

    <script></script>
  </body>
</html>
